#!/bin/bash

function domount(){
     mount -t proc  /proc $1/proc
     mount -t sysfs /sys $1/sys
     mount -o bind  /dev  $1/dev
     mount -o bind  /dev/pts  $1/dev/pts
}

function doumount(){
     umount -t proc  $1/proc
     umount -t sysfs $1/sys
     umount $1/dev
     umount $1/dev/pts
}


rootfs_dir=$1
cmd=$2


if [ $cmd == 'mount' ] && [ -n "$rootfs_dir" ] ;
then    
        echo "mount $1" 
	domount $1
elif [ $cmd == 'umount' ] && [ -n "$rootfs_dir" ] ;
then 
	echo  "umount $1"
	doumount $1
fi






